<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>背景颜色半透明</title>
    <style>
        .box {
            width: 300px;
            height: 300px;
            display: inline-block;
        }

        .normalbox {
            background-color: black;
        }

        /* 背景颜色半透明/ */
        .bantouming {
            /* 最后一个参数是alpha 透明度，取值在 0~1 之间 */
            background: rgba(138, 57, 57, 0.5);
        }
    </style>
</head>

<body>
    <div class="box normalbox"></div>
    <div class="box bantouming"></div>

</body>

</html>